package com.shihan.rabbitmq.blockingqueuedemo.BlockingQueueMQ;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Author shihan
 * @Date 2020/12/7 16:47
 * @Version 1.0
 */
public class App {

    public static void main(String[] args) {
        BlockingQueue<MyMessageObj> blockingQueue = new ArrayBlockingQueue<>(10);

        MyProducer myProducer = new MyProducer(blockingQueue);
        new Thread(myProducer).start();

        try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); }

        MyConsumer myConsumer = new MyConsumer(blockingQueue);
        new Thread(myConsumer).start();
    }
}
